<?php
header("Content-type: text/html; charset=utf-8");
//数据库连接  mysqli
$host="127.0.0.1";
$user="root";
$pwd="root";
$db="xinhuadb";
$dsn="mysql:dbname=$db;host=$host";
//改成pdo
try{
  $conn=new PDO($dsn,$user,$pwd);
}catch(Exception $e){
  die("Error!: " . $e->getMessage()."<br/>");
}

?>